Socket
Socket
Sign inDemoInstall

shell-quote

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shell-quote

quote and parse shell commands


Version published
Weekly downloads
20M
increased by2.56%
Maintainers
4
Weekly downloads
 
Created

What is shell-quote?

The shell-quote npm package is used for quoting and parsing shell commands. It can handle various shell operations such as escaping special characters, joining command-line arguments into a single string, and parsing command-line strings into an array of arguments or a function to be executed.

What are shell-quote's main functionalities?

Quoting arguments

This feature allows you to quote an array of command-line arguments into a single string that can be safely used in a shell command. It handles escaping of special characters and quotes as necessary.

var quote = require('shell-quote').quote;
var args = ['some string', 'another "string"', '$pecial'];
console.log(quote(args));

Parsing command-line strings

This feature is used to parse a command-line string into an array of arguments, taking into account the quoting and escaping rules of a typical Unix shell.

var parse = require('shell-quote').parse;
var cmd = "echo 'hello world'";
console.log(parse(cmd));

Executing parsed commands

This feature allows you to parse a command and then execute it with a given set of environment variables or other options. It can be useful for dynamically constructing and executing shell commands within a Node.js application.

var parse = require('shell-quote').parse;
var op = parse('echo $USER');
op[0]({ USER: 'alice' }); // executes the command with the given environment variable

Other packages similar to shell-quote

Keywords

FAQs

Package last updated on 07 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc